package com.itheima.web.controller.convert;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ConvertDemo implements Converter<String ,Date> {


    @Override
    public Date convert(String source) {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
        Date date = null;
        try {
             date = simpleDateFormat.parse("yyyy-MM-dd");
        } catch (ParseException e) {
            e.printStackTrace();
            System.out.println("日期转换错误");
        }
        return date;
    }
}
